<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 对象访问 .   []
        let obj = {
            id: 1,
            name: 'lisi',
            
            fn() {
                console.log("我是方法简写");
            }
        }
        console.log(obj.id);
        console.log(obj.name);
        console.log(obj['name']);
        console.log(obj['id']);
        
        let id = 'id'
        let uname = 'name'
        console.log(obj[id]);
        console.log(obj[uname]);
        console.log('----------');
        
        // 对象简写 当属性名和变量名一样的时候就可以使用
        let max = 20
        let min = 10
        let obj2 = {
            max,
            min
        }
        console.log(obj2);
        
    </script>
</body>
</html>